/******************************************************************************
 * (C) Copyright 2013 Atech-Automotive
 * FILE NAME:    app_can_Itf.h
 * DESCRIPTION:
 * 
 * DATE BEGUN:   2015/08/18
 * BY:           martin.zhang
 * PRODUCT NAME:
 * APPLICATION:
 * TARGET H/W:
 * DOC REF:
 *****************************************************************************
 */

#ifndef _APP_CAN_ITF_H_
#define _APP_CAN_ITF_H_


/*****************************************************************************
**#include 
*****************************************************************************/
#include "system.h"
#include "msg_canList.h"
#include "msg_canApi.h"
#include "drv_canCfg.h"

/*****************************************************************************
** typedef
*****************************************************************************/

extern const UINT8 u8_canReadMsgsOnceMax;
extern const UINT8 u8_canReadFastMsgsOnceMax;
extern const UINT8 u8_canTxErrNumMax;
extern const BOOL  c_b_canOsekNwmEnable;
extern const UINT32 c_u32_osekNmRxBase;
extern const UINT32 c_u32_osekNmRxIdMask;

/*****************************************************************************
** Function prototypeseb
*****************************************************************************/
extern BOOL app_canItfGetIGN(void);
extern BOOL app_canItfGetSTB(void);
extern BOOL app_canItfGetCanBusOffState(void);
extern void app_canItfEnableSTB(void);
extern void app_canItfDisableSTB(void);
extern void app_canItfCanWakeUp(void);
extern BOOL app_canItfCanSleep(void);
extern BOOL app_canItfGetSleepSts(void);

extern BOOL app_canItfCanInit(void);
extern BOOL app_canItfSendFrame(UINT32 u32_id, UINT8 u8_prio, UINT8 u8_length, UINT8 *p_u8_txData);
extern void app_canItfGetMessage(UINT32 *u32_id, UINT8 *u8_length, UINT8 *p_u8_txData);
extern UINT8 app_canItfGetRxMessageCount(void);
extern void app_canItfUpdataTxMsgs(void);
extern void app_canItfCanHandler10ms(void);

extern void app_canItfCanMsgOsek_Rx(UINT32 u32_id, UINT8 u8_length, UINT8* p_u8_txData);
extern void app_canItfRecMsg(UINT32 u32_id, UINT8 u8_length, UINT8* p_u8_Data);


/*
 * just for CAN GW.
 * Other module,please keep the default form 
*/
#if( CAN_RX_FAST == TRUE )
extern void app_canItfCanHandlerRt(void);
extern void app_canItfGetFastMessage(UINT32 *u32_id, UINT8 *u8_length, UINT8 *p_u8_txData);
extern UINT8 app_canItfGetFastRxMessageCount(void);
extern void app_canItfRecFastMsg(UINT32 u32_id, UINT8 u8_length, UINT8* p_u8_Data);
#endif


/*for other interface*/

/****************************************************************************/

#endif	//_APP_CAN_ITF_H_

/*****************************************************************************
** End File
*****************************************************************************/

